﻿#!/usr/bin/env python
# -*- coding:utf-8 -*-

'a socket example which gets html data from www.sina.com.cn'

__author__='zhaoxp'

import socket

if __name__=='__main__':
	s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
	s.bind(('127.0.0.1',9090))
	print 'Bind UDP on 9090...'
	while True:
		data,addr=s.recvfrom(1024)
		print 'Received from %s : %s' % (addr,data)
		s.sendto('hello %s!' % data,addr)
	print '-----end-----'